package com.xiaoshuidi.cloud.module.rooms.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomReservationConfig;
import com.xiaoshuidi.cloud.module.rooms.pojo.dto.reservation.RoomReservationConfigPageDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 公寓预定配置 Mapper 接口
 *
 * @author Feng
 * @since 2023-05-11
 */
@Mapper
public interface RoomReservationConfigMapper extends BaseMapper<RoomReservationConfig> {

    @Select(" select rrc.id id,  rrc.apartment_id apartmentId, ra.name apartmentName, rrc.deposit_type depositType, rrc.deposit deposit, rrc.retention_days retentionDays, rrc.status status " +
            " from room_reservation_config rrc  " +
            " left join room_apartment ra on rrc.apartment_id = ra.id " +
            " where ${ew.sqlSegment}")
    IPage<RoomReservationConfigPageDTO> pageList(@Param("ew") QueryWrapper<?> wrapper, Page<?> page);
}
